#pragma once

#include <glutwindow.h>
#include <glm/glm.hpp> 
#include <glm/gtc/matrix_transform.hpp> 

#include <vector>

class myWindow : public cwc::glutWindow
{
public:
	myWindow();

	virtual void OnRender(void);
	virtual void OnIdle();

	// When OnInit is called, a render context (in this case GLUT-Window) 
	// is already available!
	virtual void OnInit();

	virtual void OnResize(int w, int h);
	virtual void OnClose(void);
	virtual void OnMouseDown(int button, int x, int y);
	virtual void OnMouseUp(int button, int x, int y);
	virtual void OnMouseWheel(int nWheelNumber, int nDirection, int x, int y);

	virtual void OnKeyDown(int nKey, char cAscii);

	virtual void OnKeyUp(int nKey, char cAscii);

private:

    void changeObjectColor(float r, float g, float b);
    void createSpiralSphere(const float radius, const unsigned int loops, const unsigned int segmentsPerLoop);

    void renderSpiralSphere(glm::mat4 model_matrix);
    void renderXYZAxis(const float large, glm::mat4 prev_model_matrix);

    glm::mat4 view_matrix;

    GLfloat* sphere_vertex_buffer;
    GLuint* sphere_index_buffer;

    std::vector<float> vertex_buffer;
    std::vector<unsigned int> index_buffer;
    
    GLuint programHandle;
    GLuint vertShader;
    GLuint fragShader;

    float earthRotation;
    float sunRotation;
    float moonRotation;
};
